package com.ruoyi.hqfinance.controller;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.hqfinance.domain.HqNewDepartureOperateFeeSheet;
import com.ruoyi.hqfinance.domain.HqPackageChargeFeeSheet;
import com.ruoyi.hqfinance.domain.vo.HqNewDepartureOperateFeeSheetVo;
import com.ruoyi.hqfinance.domain.vo.HqPackageChargeFeeSheetVo;
import com.ruoyi.hqfinance.service.HqNewDepartureOperateFeeSheetService;
import com.ruoyi.hqfinance.service.HqPackageChargeFeeSheetService;
import com.ruoyi.logistic.domain.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/hq/packageChargeFee")
@Api(tags = "总部财务-集包费报表")
public class HqPackageChargeFeeSheetController {
    @Autowired
    private HqPackageChargeFeeSheetService hqPackageChargeFeeSheetService;

    @ApiOperation("数据汇总")
    @PostMapping("/collect")
    public R collect(@RequestBody HqPackageChargeFeeSheetVo vo){
        List<HqPackageChargeFeeSheet> sheets = hqPackageChargeFeeSheetService.collect(vo);
        if (sheets == null || sheets.size() == 0){
            return R.fail("暂无数据");
        }else {
            return R.ok(PageInfo.info(sheets));
        }
    }
}
